package com.ruoyi.project.configureSystem.domain;

import com.ruoyi.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 *
 *
 * @author ruoyi
 */
public class SysNode
{
    private static final long serialVersionUID = 1L;

//    用户id
    private Long userId;

    /** 区域ID */
    private String nodeId;

    /** 父区域ID */
    private String parentId;

    /** 祖级列表 */
    private String ancestors;

    /** 节点名称 */
    private String nodeName;

    /** 显示顺序 */
    private String orderNum;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 父区域名称 */
    private String parentName;

    /** 是否是站点（0:否，1：是） */
    private Integer isStation = 0;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    private List<SysNode> children = new ArrayList<SysNode>();

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getNodeId() {
        return nodeId;
    }

    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public List<SysNode> getChildren() {
        return children;
    }

    public void setChildren(List<SysNode> children) {
        this.children = children;
    }

    public Integer getIsStation() {
        return isStation;
    }

    public void setIsStation(Integer isStation) {
        this.isStation = isStation;
    }
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//
//        SysNode sysNode = (SysNode) o;
//
////        if (!nodeId.equals(sysNode.getNodeId())) return false;
////        return nodeId.equals(sysNode.nodeId);
//        return nodeId.equals(sysNode.getNodeId());
//    }
//
//    @Override
//    public int hashCode() {
//        //        result = 31 * result + nodeId.hashCode();
//        return nodeId.hashCode();
//    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SysNode sysNode = (SysNode) o;
        return Objects.equals(nodeId, sysNode.nodeId) &&
                Objects.equals(parentId, sysNode.parentId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(nodeId, parentId);
    }
}
